#ifndef _APP_CTX_H
#define _APP_CTX_H
#include <QObject>

#include <QMutex>
#include <QMutexLocker>
#include <QWidget>


class CAppCtx {
public:
  enum APP_MODE_ { APP_MODE_PARKING, APP_MODE_TRACKING, APP_MODE_MAX };
  enum OUTPUT_FORMAT_ {
    OUTPUT_FORMAT_JPEG = 0,
    OUTPUT_FORMAT_VIDEO,
  };

public:
  CAppCtx();

public:
  static CAppCtx *instance() {
    static QMutex mutex;
    if (!self) {
      QMutexLocker locker(&mutex);
      if (!self) {
        self = new CAppCtx;
      }
    }
    return self;
  }

public:
  QString GetFFMpegPath() { return ffmpeg_path_; };
  int SetFFMpegPath(QString path);
  QString GetModelPath() { return model_path_; };
  int SetModelPath(QString path);
  QString GetDevIP() { return dev_ip_; };
  int SetDevIP(QString ip);

private:
  static CAppCtx *self;
  void init();
  QString ffmpeg_path_;
  QString model_path_;
  QString dev_ip_;
};

#endif
